Past users, please read the section 'External Control' for important new features
The Problems:
What's going wrong in my AppleEvent routines?!?!?!?
The Solution:
AETracker!
AETracker is an INIT/CDev that allows you to log AppleEvent activity on your system. You can watch as much or as little AppleEvent manager (AEM) information as you like, and pull a little info or a lot of information about what's happening.
AETracker provides many levels of tracking, fully user configurable.
AETracker lets you track the inputs and outputs to all your AEM calls, and will show you exactly where errors are occurring.
Another very helpful use for AETracker is to sno0p other people's applications, you can get a full track of what AEM activity other applications are doing.
Enough market hype, here's the details.....
AETracker patches four traps, PostEvent, GetNextEvent, Close, and Pack8 (the AEM trap).
The first three are "housekeeping" patches for AETracker, mainly they let the CDEV and you talk to the INIT.
The PostEvent patch watches for the 'toggle' key sequence. You can set any single key + all modifiers as the toggle to turn AETracker on and off. Be SURE that you are not using that keystroke in another INIT or Application, since AETracker will eat the
event when it sees it, or alternately another INIT may already have
eaten it.
The PostEvent patch also looks for an event posted by the CDEV that tells it to reload the CDEV resources, that's how you can change AETracker's settings without rebooting the machine.
The GetNextEvent patch looks for flags that the PostEvent patch sets, and does things based on the flag, since GNE is memory moving safe and PostEvent ain't.
The Close patch is designed to keep the AETrack file open until you close it, despite ExitToShell trying to close the file when the app that was frontmost when it was created quits.
• Note: Because the Close patch exists, you have to _explicitly_ tell AETracker to turn itself off. That's why the flashing indicator in the menu bar exists, to let you know that AETracker is still running, so you don't end up with a lot bigger track file than you anticipated.
The Pack8 patch is where the real business happens;
When AETracker is toggled on, here's what happens....
A work file is opened, it will be named "AETrackXXXX" where
XXXX is Ticks at toggle time (creative, huh?). This file will always be
created in the Control Panels folder until you set a different directory with the button in the Control Panel.
• Note: In the unlikely instance that there is already a file named AETrack-XXXX in the control panels folder, AETracker will increment the first letter of the name until it can create the file, so you'll get things like BETrack-XXXX, CETrack-XXXX.
It may seem like that'll never happen, but I've done it twice during debugging.
You can change the file name by modifying 'STR ' resource -4064, but
whatever you change it to will still have the XXXX appended to it.
The Pack8 (AppleEvent manager) patch is enabled. Depending on the
myriad settings you can make, that patch will start writing data
to the work file.
AppleEvent traffic happens, and a nice log is written out.
The log will contain information about which routine was called, what application called it, when (in ticks) it was called, what parameters were passed to it, and what parameters were returned. Again, the amount of info in the log will depend on the settings you give the the Control Panel.
Also, a small black circle will flash in the right side of the menu bar, so you can tell that AETracker is tracking.
Here's a small sample, taken from a log of my AEObject sample